package com.ieasy.module.oa.project.web.action;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;
import com.ieasy.basic.model.Msg;
import com.ieasy.basic.util.cons.Const;
import com.ieasy.module.common.web.action.BaseController;
import com.ieasy.module.oa.project.service.IProjectRyListService;
import com.ieasy.module.oa.project.web.form.ProjectRyListForm;

@Controller
@RequestMapping("/admin/oa/projectRY")
public class ProjectRyListAction extends BaseController {

	@Autowired
	private IProjectRyListService projectRyService ;
	
	@RequestMapping("/project_ry_form_UI.do")
	public String quotient_form_UI(ProjectRyListForm form, Model mode){
		if(null != form.getProjectId() && !"".equals(form.getProjectId())) {
			mode.addAttribute("projectId", form.getProjectId()) ;
		}
		return Const.PROJECT + "project_ry_form_UI" ;
	}
	
	
	@RequestMapping("/get.do")
	@ResponseBody
	public ProjectRyListForm get(ProjectRyListForm form){
		return this.projectRyService.get(form) ;
	}
	
	@RequestMapping("/add.do")
	@ResponseBody
	public Msg add(@RequestBody List<ProjectRyListForm> forms){
		String jsonStr = JSON.toJSONString(forms);
		List<ProjectRyListForm> ProjectRyListForms = JSON.parseArray(jsonStr, ProjectRyListForm.class);  
		return this.projectRyService.addList(ProjectRyListForms) ;
	}
	
	@RequestMapping("/list.do")
	@ResponseBody
	public List<ProjectRyListForm> list(ProjectRyListForm form){
		return this.projectRyService.list(form) ;
	}
	
	
}
